import request from '@/utils/request'

export const workflowApi = {
  // 获取工作流列表
  getWorkflows() {
    return request.get('/workflows')
  },

  // 获取工作流详情
  getWorkflow(id: string) {
    return request.get(`/workflows/${id}`)
  },

  // 创建工作流
  createWorkflow(data: any) {
    return request.post('/workflows', data)
  },

  // 更新工作流
  updateWorkflow(id: string, data: any) {
    return request.patch(`/workflows/${id}`, data)
  },

  // 删除工作流
  deleteWorkflow(id: string) {
    return request.delete(`/workflows/${id}`)
  },

  // 执行工作流
  executeWorkflow(id: string, params: any) {
    return request.post(`/workflows/${id}/execute`, params)
  },

  // 获取执行状态
  getExecuteStatus(taskId: string) {
    return request.get(`/tasks/${taskId}/status`)
  },

  // 获取执行结果
  getExecuteResult(taskId: string) {
    return request.get(`/tasks/${taskId}/result`)
  }
} 